﻿@model List<CMSTextWidgetPicker>
@{
	ViewBag.Title = "Text Widget Index";
}

<p>
	These assemblies and classes listed below will be used to pre-process the text content types selected when rendered in the CMS via the associated page.
	If you don't want a particular class to be used for processing, simply uncheck all boxes on that entry's row and it will no be used for processing.
</p>

@using (Html.BeginForm()) {
	@Html.AntiForgeryToken()

	<div style="height: 50px; margin-top: 10px; margin-bottom: 10px;">
		<input type="submit" name="btnSave" value="Save" id="btnSave" />
	</div>

	<div>
		@{
	var grid = CarrotWeb.CarrotWebGrid<CMSTextWidgetPicker>(Model);

	grid.TableAttributes = new { @class = "datatable" };
	grid.THeadAttributes = new { @class = "tablehead" };
	grid.EmptyDataTemplate = @<text><p> <b>No records found.</b> </p></text>;
	grid.UseDataPage = false;
	grid.ConfigName(Html.NameFor(x => x));

	grid
	.AddColumn(x => x.DisplayName, new CarrotGridColumn { HeaderText = "Display Name" })
	.AddColumn(x => x.AssemblyString, new CarrotGridColumn { HeaderText = "Assembly String" })

	.AddColumn(new CarrotGridTemplateColumn<CMSTextWidgetPicker> {
		HeaderText = "Body",
		BodyAttributes = new { @class = "centerItem" },
		FormatTemplate = @<text> @grid.FormFieldFor(m => m.ProcessBody, GridFormFieldType.Checkbox)
		@grid.FormFieldFor(m => m.TextWidgetPickerID, GridFormFieldType.Hidden)
		@grid.FormFieldFor(m => m.AssemblyString, GridFormFieldType.Hidden)
		@grid.FormFieldFor(m => m.DisplayName, GridFormFieldType.Hidden)
		</text> })
	.AddColumn(new CarrotGridTemplateColumn<CMSTextWidgetPicker> {
		HeaderText = "Plain Text",
		BodyAttributes = new { @class = "centerItem" },
		FormatTemplate = @<text> @grid.FormFieldFor(m => m.ProcessPlainText, GridFormFieldType.Checkbox)
		</text> })
	.AddColumn(new CarrotGridTemplateColumn<CMSTextWidgetPicker> {
		HeaderText = "HTML Text",
		BodyAttributes = new { @class = "centerItem" },
		FormatTemplate = @<text> @grid.FormFieldFor(m => m.ProcessHTMLText, GridFormFieldType.Checkbox)
		</text> })
	.AddColumn(new CarrotGridTemplateColumn<CMSTextWidgetPicker> {
		HeaderText = "Comment",
		BodyAttributes = new { @class = "centerItem" },
		FormatTemplate = @<text> @grid.FormFieldFor(m => m.ProcessComment, GridFormFieldType.Checkbox)
		</text> })
	.AddColumn(new CarrotGridTemplateColumn<CMSTextWidgetPicker> {
		HeaderText = "Snippet",
		BodyAttributes = new { @class = "centerItem" },
		FormatTemplate = @<text> @grid.FormFieldFor(m => m.ProcessSnippet, GridFormFieldType.Checkbox)
		</text> });

		@grid.OutputHtmlBody()

		}

	</div>
}